from selenium.webdriver.common.by import By
from autoTest_ecshop.base_page.base import BasePage
class MainPage(BasePage):

    selMenu_locator=(By.CSS_SELECTOR, '[name="snatch_name"]')
    #商品关键字
    keyword_locator = (By.CSS_SELECTOR, '[name="keywords"]')
    #点击搜索
    research_locator = (By.CSS_SELECTOR, '[onclick="searchGoods()"]')
    #描述信息
    huodongmiaos_locator = (By.CSS_SELECTOR, '[name="desc"]')
    #提交按钮
    submit_locatore = (By.CSS_SELECTOR, '[type="submit"]')
    #开始时间
    js_startTime = 'document.querySelectorAll("#start_time_id")[0].removeAttribute("readonly")'
    #输入开始时间
    startTime_locator = (By.CSS_SELECTOR, "#start_time_id")
    #结束时间
    js_endtTime = 'document.querySelectorAll("#end_time_id")[0].removeAttribute("readonly")'
    #输入结束时间
    endTime_locator = (By.CSS_SELECTOR, "#end_time_id")
    #添加成功页面
    actul_loc = (By.XPATH, '//tbody/tr/td[2]')


    def input_time(self,attribute,stime):
        #执行js， 删除readonly属性
        self.execute_js(attribute)
        #输入活动开始时间
        self.input_data(stime)